package com.example.feign.service;

import com.example.api.constant.Client1URL;
import feign.Feign;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author wangxianchen
 * @create 2017-12-27
 * @desc
 */
//@FeignClient(value = "WXC", fallback = FeignService.Fallback.class)
public interface FeignService {


    @GetMapping(Client1URL.HI)
    String hi(@RequestParam("name") String name);



/*    //断路器
    class Fallback implements FeignService {

        @Override
        public String hi(String name) {
            return "sorry,call "+Client1URL.SERVICE_NAME+" service is fail";
        }


    }

    @Configuration
    class configuration {
        @Bean
        @Scope("prototype")
        public Feign.Builder feignBuilder() {
            return Feign.builder();
        }

        @Bean
        public Fallback fb2() {
            return new Fallback();
        }
    }*/

}
